package com.rephilo.email.controller;

import com.rephilo.email.service.EmailSendServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 发送email接口
 *
 * @author rephilo
 */
@RestController
@RequestMapping("/api/email")
public class EmailController {

    @Autowired
    private EmailSendServiceImpl emailSendService;

    /**
     * 邮件发送接口
     *
     * @param receiver
     * @param subject
     * @param content
     * @return
     */
    @PostMapping("/{email}/{code}")
    public Boolean sendEmail(@PathVariable String email,
                             @RequestParam String subject,
                             @PathVariable String code) {
        emailSendService.sendHtmlMail(email, subject, code);
        return true;
    }
}
